package com.linchong.concurrency.threadPool;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author linchong
 * @version 1.0
 * @Date: 2020-12-09 13:01
 * @Description: ThreadPoolExample1$
 */
@Slf4j
public class ThreadPoolExample2 {
	public static void main(String[] args) {
		ExecutorService executorService = Executors.newFixedThreadPool(3);
		for (int i = 0; i < 10; i++) {
			final int index = i;
			executorService.execute(()-> log.info("task:{}",index));
		}
		executorService.shutdown();
	}

}
